{
    let list = new Set();
    list.add(5);
    list.add(7);
    list.add(7);
    console.log('size', list.size, list);
}

{
    let arr = [1, 2, 3, 4, 5];
    let list = new Set(arr);
    console.log('size', list.size, list);

    // 会把重复的内容自动去了, 不会自动做类型转化
    let arr2 = [1, 2, 3, 4, 1, 2, '2'];
    let list2 = new Set(arr2);
    console.log('unique---list2', list2.size, list2);
}

{
    let arr = ['add', 'delete', 'clear', 'has'];
    let list = new Set(arr);

    // set的方法, 返回boolean
    console.log('has', list.has('add'));
    console.log('delete', list.delete('add'), list);
    list.clear();
    console.log('list', list);
}

{
    let arr = ['add', 'delete', 'clear', 'has'];
    let list = new Set(arr);

    for (let key of list.keys()) {
        console.log('keys', key);
    }
    for (let value of list.values()) {
        console.log('value', value);
    }
    for (let [key, value] of list.entries()) {
        console.log('entries', key, value);
    }

    list.forEach(function (item) { console.log(item); })
}

{
    let weakList = new WeakSet();

    let arg = {};

    weakList.add(arg);

    // weakList.add(2); // 报错

    console.log('weakList', weakList);
}


{
    let map = new Map();
    let arr = ['123'];
    map.set(arr, 456);
    map.set('aaa', 456);
    console.log('map', map, map.get(arr));
}

{
    let map = new Map([['a', 123], ['b', 456]]);
    console.log('map args', map);
    console.log('size', map.size);
    console.log('delete', map.delete('a'), map);
    console.log('clear', map.clear(), map);
}

{
    let weakmap = new WeakMap();
    let o = {};
    weakmap.set(o, 123);
    console.log(weakmap, weakmap.get(o));
}


